package guilddto

import (
	"github.com/gogf/gf/v2/frame/g"
	"github.com/gogf/gf/v2/util/gconv"
	"xr-game-server/entity"
)

// 转让公会会长响应

// 获取公会信息请求
type GuildInfoReq struct {
	g.Meta  `path:"/info" method:"post" summary:"获取公会信息" tags:"公会"`
	GuildId uint64 `json:"guildId" v:"required" summary:"公会ID"`
}

// 公会信息响应
type GuildInfoRes struct {
	ID          string `json:"guildId" summary:"公会ID"`
	Name        string `json:"name" summary:"公会名称"`
	Description string `json:"description" summary:"公会描述"`
	PresidentId string `json:"presidentId" summary:"会长ID"`
	Level       string `json:"level" summary:"公会等级"`
	Exp         string `json:"exp" summary:"公会经验"`
	CreateTime  string `json:"createTime" summary:"创建时间"`
	MemberCount int    `json:"memberCount" summary:"成员数量"`
}

// 将entity.Guild转换为DTO
func NewGuildInfoRes(guild *entity.Guild, members int) *GuildInfoRes {
	ret := new(GuildInfoRes)
	gconv.Struct(guild, ret)
	ret.MemberCount = members
	ret.CreateTime = guild.CreatedAt.Format("2006-01-02 15:04:05")
	return ret
}
